﻿/* 
 * author: www.cnblogs.com/luminji
 * date  : 2012/01/28
 */
using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Luminji.Core.reflect;

namespace Luminji.Core.UnitTest.reflect
{
    [TestClass]
    public class ObjectFactoryTest
    {

        [TestMethod]
        public void ObjectCanBeCreateByOF()
        {
            SampleClass s = ObjectFactory.CreateInstance(typeof(SampleClass), 2, "3", new sb()) as SampleClass;
            Assert.AreEqual("23", s.GetResult());
        }

        private class SampleClass
        {
            int _a;
            string _b;
            sb _sb;

            public SampleClass(int a, string b, sb sb)
            {
                _a = a;
                _b = b;
                _sb = sb;
            }

            public string GetResult()
            {
                return _a.ToString() + _b;
            }
        }

        private class sb
        {
        }
    }


}
